package com.yyz.zjjcms.model;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * CmsTab entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "cms_tab", catalog = "zjjcms")
public class CmsTab implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = -8969956000302335620L;
	private String id;
	private User userByModifyUserId;
	private User userByNewUserId;
	private Timestamp newDate;
	private Timestamp modifyDate;
	private Set<CmsTabValue> cmsTabValues = new HashSet<CmsTabValue>(0);
	private Set<CmsAttribute> cmsAttributes = new HashSet<CmsAttribute>(0);

	// Constructors

	/** default constructor */
	public CmsTab() {
	}

	/** minimal constructor */
	public CmsTab(String id, User userByModifyUserId, User userByNewUserId) {
		this.id = id;
		this.userByModifyUserId = userByModifyUserId;
		this.userByNewUserId = userByNewUserId;
	}

	/** full constructor */
	public CmsTab(String id, User userByModifyUserId, User userByNewUserId,
			Timestamp newDate, Timestamp modifyDate,
			Set<CmsTabValue> cmsTabValues, Set<CmsAttribute> cmsAttributes) {
		this.id = id;
		this.userByModifyUserId = userByModifyUserId;
		this.userByNewUserId = userByNewUserId;
		this.newDate = newDate;
		this.modifyDate = modifyDate;
		this.cmsTabValues = cmsTabValues;
		this.cmsAttributes = cmsAttributes;
	}

	// Property accessors
	@Id
	@Column(name = "Id", nullable = false, length = 36)
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "org.hibernate.id.UUIDGenerator")
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "modify_user_id", nullable = false)
	public User getUserByModifyUserId() {
		return this.userByModifyUserId;
	}

	public void setUserByModifyUserId(User userByModifyUserId) {
		this.userByModifyUserId = userByModifyUserId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "new_user_id", nullable = false)
	public User getUserByNewUserId() {
		return this.userByNewUserId;
	}

	public void setUserByNewUserId(User userByNewUserId) {
		this.userByNewUserId = userByNewUserId;
	}

	@Column(name = "new_date", length = 19)
	public Timestamp getNewDate() {
		return this.newDate;
	}

	public void setNewDate(Timestamp newDate) {
		this.newDate = newDate;
	}

	@Column(name = "modify_date", length = 19)
	public Timestamp getModifyDate() {
		return this.modifyDate;
	}

	public void setModifyDate(Timestamp modifyDate) {
		this.modifyDate = modifyDate;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cmsTab")
	public Set<CmsTabValue> getCmsTabValues() {
		return this.cmsTabValues;
	}

	public void setCmsTabValues(Set<CmsTabValue> cmsTabValues) {
		this.cmsTabValues = cmsTabValues;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "cmsTab")
	public Set<CmsAttribute> getCmsAttributes() {
		return this.cmsAttributes;
	}

	public void setCmsAttributes(Set<CmsAttribute> cmsAttributes) {
		this.cmsAttributes = cmsAttributes;
	}

}